using System;
using System.Collections.Generic;
using System.Text;

using System.Data;
using System.Data.Common;
using Husb.Data;
using Husb.DataUtil;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Caching;

using CentralOffice.Admin.Data;

using SysParaTable = CentralOffice.Admin.Data.SysParaDataSet.Sys_ParaDataTable;
using SysParaRow = CentralOffice.Admin.Data.SysParaDataSet.Sys_ParaRow;

namespace CentralOffice.Admin.DataAccess
{
    public class SysParaAdapter : DataAccessAdapter<Admin.Data.SysParaDataSet, SysParaTable, SysParaRow>
    {
        public SysParaAdapter()
        {
            this.TableName = "Sys_Para";
            InsertStoredProc = "Admin.SysPara_InsertSysPara";
            DeleteStoredProc = "Admin.SysPara_DeleteSysPara";

            GetAllStoredProc = "Admin.SysPara_SelectSysParaAll";
            UpdateStoredProc = "Admin.SysPara_UpdateSysPara";
            FindStoredProc = "Admin.SysPara_SelectSysParaDynamic";
            GetByIdStoredProc = "Admin.SysPara_SelectSysPara";
        }

        protected override void PopulateInsertParameters(Database db, DbCommand cmd)
        {
            db.AddInParameter(cmd, "ParaName", DbType.String, "ParaName", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "ParaValue", DbType.String, "ParaValue", System.Data.DataRowVersion.Current);
            db.AddInParameter(cmd, "Remark", DbType.String, "Remark", System.Data.DataRowVersion.Current);
        }

        protected override void PopulateUpdateParameters(Database db, DbCommand cmd)
        {
            //base.PopulateUpdateParameters(db, cmd);
            db.AddInParameter(cmd, "Id", DbType.Int32, "ParaId", System.Data.DataRowVersion.Current);
            PopulateInsertParameters(db, cmd);
        }
    }
}
